package controller

import (
	"gin/response"
	"gin/service"
	"github.com/gin-gonic/gin"
)

var (
	tenantService = service.Tenant{}
)

type Tenant struct {
}

type GetWorkBaseReq struct {
	TenantId uint64 `json:"tenant_id" binding:"required"`
}

// GetWorkBase 获取租户办公地点
func (c *Tenant) GetWorkBase(ctx *gin.Context) {

	var req GetWorkBaseReq
	err := ctx.ShouldBindJSON(&req)

	if err != nil {
		response.Fail(ctx, nil, err.Error())
		return
	}

	resData, queryErr := tenantService.GetWorkBase(req.TenantId)
	if queryErr != nil {
		// 查询失败
		response.Fail(ctx, nil, queryErr.Error())
	} else {
		// 查询成功
		response.Success(ctx, gin.H{"data": resData}, "success")
	}
}
